/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.carpark.entities;

import cz.muni.fi.pa165.carpark.EmployeePosition;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;

/**
 *
 * @author Martin Derka
 */
@Entity
public class Employee implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Enumerated(EnumType.STRING)
    @NotNull
    private EmployeePosition position;
    @NotBlank
    private String name;

    /**
     * Get id of the employee
     *
     * @return id of the employee
     */
    public Long getId() {
        return id;
    }

    /**
     * Sets id of the employee. Id null indicates that the employee is not in
     * the database yet.
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Get the value of position
     *
     * @return the value of position
     */
    public EmployeePosition getPosition() {
        return position;
    }

    /**
     * Set the value of position
     *
     * @param position new value of position
     */
    public void setPosition(EmployeePosition position) {
        this.position = position;
    }

    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     */
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Employee)) {
            return false;
        }
        Employee other = (Employee) object;
        if ((this.id != null && !this.id.equals(other.id)) || (this.id == null && other.id != null)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Employee[ id=" + id + ", name=" + name + ", position=" + position + " ]";
    }
}
